# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=hotspot
pkgver=1.3.0
pkgrel=0
pkgdesc="The Linux perf GUI for performance analysis"
url="https://github.com/KDAB/hotspot"
# s390x: undefined reference to 'QDataStream::Version qbswap<QDataStream::Version>(QDataStream::Version)'
# riscv64, armhf: missing qtdeclarative
arch="all !s390x !armhf !riscv64"
license="GPL-2.0-or-later"
makedepends="cmake qt5-qtbase-dev elfutils-dev gettext-dev extra-cmake-modules
	threadweaver-dev ki18n-dev kconfigwidgets-dev kcoreaddons-dev kitemviews-dev
	kitemmodels-dev kio-dev solid-dev kwindowsystem-dev"
options="!check" # wonky tests
source="https://github.com/KDAB/hotspot/releases/download/v$pkgver/hotspot-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/usr/share/applications
	cp hotspot.desktop "$pkgdir"/usr/share/applications
}

sha512sums="8aa89f71cb85c5a73c8265eec27acf35fcc21612af33581c7d8804edbc8565cd587ab79906e85781f2c6db9d7747ba4371a7e10253e21052f280717d5dc1fbd4  hotspot-v1.3.0.tar.gz"
